[#ftl]	
[@declare "agile.core._Sortable"]
	sortAxis:"xy"
	,sortChildren:function(){
		if(this.sortAxis == "xy") return;
		
		var children = [];			
		var childrenWH = [];
		array.forEach(this.getChildren(),function(child){
			var box = agile.calcSize(child.domNode);
			var index = (this.sortAxis == "x"? box.l : box.t);				
			while(children[index] != null){
				index++;
			}
			children[index] = child;
			childrenWH[index] = (this.sortAxis == "x"?box.w : box.h);
			if(childrenWH[index] == null || childrenWH[index] == 0){
				childrenWH[index] = child.getPreferredSize()[this.sortAxis == "x"? "w": "h"];
			}
		},this);
		
		
		children = array.filter(children,function(child){
			return child != null;
		});
		
		childrenWH = array.filter(childrenWH,function(child){
			return child != null;
		});

		if(children.length > 0){			
			children[0].style1(this.sortAxis == "x"? "left" : "top",1);
			for(var i = 1; i < children.length; i++){
				children[i].style1(this.sortAxis == "x"? "left" : "top",i * childrenWH[i - 1]);
			}
		}				
			
	}
[/@]
